package no.ntnu.fp.handlers;

import no.ntnu.fp.handler.Handler;
import no.ntnu.fp.messages.Message;
import no.ntnu.fp.messages.impl.NoticeAddedOrUpdatedMessage;
import no.ntnu.fp.model.NoticeModel;

public class NoticeAddedOrUpdatedHandler implements Handler {
	private final NoticeModel noticeModel;
	
	public NoticeAddedOrUpdatedHandler(NoticeModel noticeModel) {
		this.noticeModel = noticeModel;
	}

	@Override
	public void handleMessage(Message message) {
		NoticeAddedOrUpdatedMessage noticeUpdatedMessage
											= (NoticeAddedOrUpdatedMessage)message;
		
		noticeModel.addOrUpdateNotice(noticeUpdatedMessage.getNotice());
	}

}
